<template>
  <div id="app">
    <router-view></router-view>
    <van-tabbar route class="van-tabbar" v-if="isShow">
      <van-tabbar-item replace to="/" icon="home-o">首页</van-tabbar-item>
      <van-tabbar-item replace to="/release" icon="add-o">发布</van-tabbar-item>
      <van-tabbar-item replace to="/user" icon="user-o">我的</van-tabbar-item>
    </van-tabbar>
  </div>
</template>

<script>
export default {
  name: 'App',
  data() {
    return {
      isShow: true
    }
  },
  mounted() {
    if (!localStorage.getItem('token')) {
      this.$router.push('/login');
      this.isShow = false;
    } else {
      this.isShow = true;
    }
  }
}
</script>

<style>
.van-tabbar {
  width: 100%;
  height: 50px;
  position: fixed;
  bottom: 0;
}
</style>